--[[/**
-- * 
 * 所受伤害由目标代替我承受
 * [0] n 万分比
-- *
-- */]]

---@class BuffEffect92032102 : BaseBuffEffect
BuffEffect92032102 = ClientFight.CreateClass("BuffEffect92032102", ClientFight.BaseBuffEffect)
local t = BuffEffect92032102

---@param fight Fight
---@param buff FighterBuff
function t:add(fight, buff)
    local buffEffectValue = buff.buffBean.f_BuffEffectValue;
    local target = buff.target;
    local skillHurtCorrectMap = target.parametersByObject[FightUsingSkill.HurtCorrectFactor] or {};
    for i = 2, table.getn(buffEffectValue) do
        local old = skillHurtCorrectMap[buffEffectValue[i]] or 0;
        skillHurtCorrectMap[buffEffectValue[i]] = old + buffEffectValue[1];
    end
    SkillRoleMgr.savePathFile("[" .. fight.frame .. "][EFFECT]Fighter " .. buff.target.fighterId .. " Buff"
            .. buff.modelId .. " 增加技能的攻击系数值:" .. getJsonStr(buffEffectValue));
    target.parametersByObject[FightUsingSkill.HurtCorrectFactor] = skillHurtCorrectMap;
    return ClientFight.BaseBuffEffect.add(self, fight, buff);
end

function t:remove(fight, buff, force, ...)
    local parameters = {...};
    local buffEffectValue = buff.buffBean.f_BuffEffectValue;
    local target = buff.target;
    local skillHurtCorrectMap = target.parametersByObject[FightUsingSkill.HurtCorrectFactor] or {};
    for i = 2, table.getn(buffEffectValue) do
        local old = skillHurtCorrectMap[buffEffectValue[i]] or 0;
        skillHurtCorrectMap[buffEffectValue[i]] = old - buffEffectValue[1];
    end
    SkillRoleMgr.savePathFile("[" .. fight.frame .. "][EFFECT]Fighter " .. buff.target.fighterId .. " Buff"
            .. buff.modelId .. " 减少技能的攻击系数值:" .. getJsonStr(buffEffectValue));
    target.parametersByObject[FightUsingSkill.HurtCorrectFactor] = skillHurtCorrectMap;
 return ClientFight.BaseBuffEffect.remove(self, fight, buff, force, ...);
end
t.New()